import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { configService } from './config';
import { DbService } from './db/db.service';
import { NewsModule } from './news/news.module';
import { VideoModule } from './video/video.module';

@Module({
  imports: [NewsModule, VideoModule],
  controllers: [AppController],
  providers: [
    AppService,
    configService,
    {
      provide: 'DBService',
      inject: ['configService'],
      useFactory(configService) {
        console.log(configService);
        return new DbService(configService.name);
      },
    },
  ],
})
export class AppModule {}
